<%@page import="com.metacube.metaconnect.Service.UserInformationService"%>
<%@page import="java.util.*"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<link rel="Stylesheet" href="css/home.css" type="text/css">

<%
if(session.getAttribute("emailId")==null)
{
	response.sendRedirect("index.jsp");
}
else
{
ArrayList userInfo = new UserInformationService().getuserInfo(request.getParameter("userEmail"));
%>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>
<%
	if(request.getAttribute("userDetails")!=null)
	{
		request.setAttribute("userDetails", request.getAttribute("userDetails"));
	}
%>
<%
try
{
	if(userInfo.size()==0)
		response.sendRedirect("home.jsp");
	else if(userInfo.get(0)!=null)
		%>
		<%=userInfo.get(0).toString() %>
<%
}
catch(Exception ex){ex.printStackTrace();}
%>
</title>
<script type="text/javascript" src="js/UserProfile.js">
</script>
</head>
<body>

<%String path=""; %>
<div id=wrapper>
	<jsp:include page="HomeHeader.jsp"></jsp:include>
	<div id=main-container >
	<div id="left-container">
		<%if(userInfo.size()==5){ %>
		<table cellpadding="5" cellspacing="5">
			<tr>
				<td>
						<% 
							if(userInfo.get(4)!=null){	
						%>
						<%path="Upload/"+userInfo.get(4).toString(); %>
		
						<%}else if(userInfo.get(1).toString().equals("Male")){ 
						path="Upload/male.jpg";%>
						<%}else { path="Upload/female.jpg";%>
							<%} %>
							<img class=photo alt="hello" src="<%=path %>" >
						
				</td>
			</tr>
			<tr>
				<td>
					<hr/>
					<font size="+2" >
					<% 
						if(userInfo.get(0)!=null){	
					%>
					<%=userInfo.get(0).toString() %>
					<%} %>
					</font>
				</td>
			</tr>
			<tr>
				<td>
					<span class="Info">Project:</span>
					<span class=userInfo > <% 
							if(userInfo.get(2)!=null){	
						%>
						<%=userInfo.get(2).toString() %>
						<%} %> </span>
				</td>
			</tr>
			<tr>
				<td>
					<span class="Info"> Designation: </span>
					<span class=userInfo ><% 
							if(userInfo.get(3)!=null){	
						%>
						<%=userInfo.get(3).toString() %>
						<%} %></span>
				</td>
			</tr>
			<tr>
				<td>
					<hr/>
					<%if(request.getParameter("userEmail").equals(session.getAttribute("emailId").toString())) {%>
						<html:link styleClass="link" action="UpdateProfileController">Update Your Profile</html:link><%} %>
				</td>
			</tr>
		</table>
				<%} %>
	</div>
	<div id="middle-container">
		
		<%request.setAttribute("path",path); %>
		<div id="posts">
				<%if(request.getAttribute("userDetails")==null && request.getParameter("userEmail")==null) {%>
				<jsp:include page="Posts.jsp"></jsp:include><%}
				
				else if(request.getParameter("userEmail")!=null){
				String userEmail =request.getParameter("userEmail");%> 
				<jsp:include page="OtherUserProfile.jsp?userEmail=<%=userEmail %>"></jsp:include>
				<%}
				else{ %>
				<jsp:include page="editprofile.jsp"></jsp:include><%} %>
			
			
		</div>
	</div>
	<div id="right-container">
			<jsp:include page="events.jsp"></jsp:include>
		</div>
	</div>
	<jsp:include page="Footer.html"></jsp:include>
	
	</div>
</body>
<%} %>
</html>